<template>
  <div class='commonHeader'>
    <div class="left111">
      <img src="../assets/images/logo2.png" alt="" class="logopng" @click="tologin">
      <div class="city" @click="choosecity">
        {{LocationCity}}
        <img src="../assets/images/bottom.png" alt="" class="bottomstyle">
      </div>
      <span class="phoneStyle">咨询热线：{{ phonenum }}</span>
      <div class="citybox" v-show="citybox">
        <div class="citybox1">周边城市</div>
        <div class="citybox1line">
              <span v-for="(item,index) in listall" :key="index" :class="chosearea==index?'choseareanow':''" @click="choosearea(index,item)" >
                {{item.cityName}}
              </span>
        </div>
        <div class="citybox1">热门城市</div>
        <div class="citybox1line">
              <span v-for="(item,index) in hotcity" :key="index" :class="choosehot==index?'choseareanow':''" @click="choosehots(index,item)" >
                {{item.cityName}}
              </span>
        </div>
        <div class="citybox1">所有城市</div>
        <div class="citybox1line">
          <div>
            <text style="color: red">A：</text><span v-for="(item,index) in allcity" :key="index" :class="chooseallIndexA==index?'choseareanow':''" @click="chooseallA(index,item)" >
                {{item.cityName}}
               </span>
          </div>
          <div>
            <text style="color: red">B：</text><span v-for="(item,index) in allcity2" :key="index" :class="chooseallIndexB==index?'choseareanow':''" @click="chooseallB(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red"> C：</text><span v-for="(item,index) in allcity3" :key="index" :class="chooseallIndexC==index?'choseareanow':''" @click="chooseallC(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">D：</text><span v-for="(item,index) in allcity4" :key="index" :class="chooseallIndexD==index?'choseareanow':''" @click="chooseallD(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">E：</text><span v-for="(item,index) in allcity5" :key="index" :class="chooseallIndexE==index?'choseareanow':''" @click="chooseallE(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">F：</text><span v-for="(item,index) in allcity6" :key="index" :class="chooseallIndexF==index?'choseareanow':''" @click="chooseallF(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">G：</text><span v-for="(item,index) in allcity7" :key="index" :class="chooseallIndexG==index?'choseareanow':''" @click="chooseallG(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">H：</text><span v-for="(item,index) in allcity8" :key="index" :class="chooseallIndexH==index?'choseareanow':''" @click="chooseallH(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">J：</text><span v-for="(item,index) in allcity9" :key="index" :class="chooseallIndexJ==index?'choseareanow':''" @click="chooseallJ(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">K：</text><span v-for="(item,index) in allcity10" :key="index" :class="chooseallIndexK==index?'choseareanow':''" @click="chooseallK(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">L：</text><span v-for="(item,index) in allcity11" :key="index" :class="chooseallIndexL==index?'choseareanow':''" @click="chooseallL(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">M：</text><span v-for="(item,index) in allcity12" :key="index" :class="chooseallIndexM==index?'choseareanow':''" @click="chooseallM(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">N：</text><span v-for="(item,index) in allcity13" :key="index" :class="chooseallIndexN==index?'choseareanow':''" @click="chooseallN(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">P：</text><span v-for="(item,index) in allcity14" :key="index" :class="chooseallIndexP==index?'choseareanow':''" @click="chooseallP(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">Q：</text><span v-for="(item,index) in allcity15" :key="index" :class="chooseallIndexQ==index?'choseareanow':''" @click="chooseallQ(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">R：</text><span v-for="(item,index) in allcity16" :key="index" :class="chooseallIndexR==index?'choseareanow':''" @click="chooseallR(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">S：</text><span v-for="(item,index) in allcity17" :key="index" :class="chooseallIndexS==index?'choseareanow':''" @click="chooseallS(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">T：</text><span v-for="(item,index) in allcity18" :key="index" :class="chooseallIndexT==index?'choseareanow':''" @click="chooseallT(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">W：</text><span v-for="(item,index) in allcity19" :key="index" :class="chooseallIndexW==index?'choseareanow':''" @click="chooseallW(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">X：</text><span v-for="(item,index) in allcity20" :key="index" :class="chooseallIndexX==index?'choseareanow':''" @click="chooseallX(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">Y：</text><span v-for="(item,index) in allcity21" :key="index" :class="chooseallIndexY==index?'choseareanow':''" @click="chooseallY(index,item)" >
                {{item.cityName}}
              </span>
          </div>
          <div>
            <text style="color: red">Z：</text><span v-for="(item,index) in allcity22" :key="index" :class="chooseallIndexZ==index?'choseareanow':''" @click="chooseallZ(index,item)" >
                {{item.cityName}}
              </span>
          </div>
        </div>
      </div>
    </div>
    <div class="right111">
      <span v-for="(item,index) in kindList" :key="index" :class="propdatas == item.value ? 'chosenKindStyle':''"
            @click="eachKind(index)">
        <img v-if="index==3" src="../assets/images/dowphone.png" alt="" class="downphone">
        <img src="../assets/images/heng.png" alt="" class="downall">
        {{item.name}}
      </span>
    </div>
<!--    <div>-->
<!--      <span class='login'>登录</span>-->
<!--      <span class='register'>注册</span>-->
<!--    </div>-->
  </div>
</template>

<script>
import AMap from 'AMap'
import {updateFrontUser} from "@/api/vip";
export default {
  name:"commonHeader",
  props:['propdatas'],
  data(){
    return{
      cityId:'',
      citybox:false,
      LocationCity:'' ,   //给渲染层定义一个初始值
      kindList:[
        {name:"首页",value:0},
        {name:"楼盘查询",value:1},
        {name:"加入我们",value:2},
        {name:"下载APP",value:3},
      ],
      chosenKind:0,
      phonenum:'',
      listall:[],
      hotcity:[],
      allcity:[],
      chosearea:null,
      choosehot:null,
      choosealla:null,
      allcity2:[],
      allcity3:[],
      allcity4:[],
      allcity5:[],
      allcity6:[],
      allcity7:[],
      allcity8:[],
      allcity9:[],
      allcity10:[],
      allcity11:[],
      allcity12:[],
      allcity13:[],
      allcity14:[],
      allcity15:[],
      allcity16:[],
      allcity17:[],
      allcity18:[],
      allcity19:[],
      allcity20:[],
      allcity21:[],
      allcity22:[],
      chooseallIndexA:null,
      chooseallIndexB:null,
      chooseallIndexC:null,
      chooseallIndexD:null,
      chooseallIndexE:null,
      chooseallIndexF:null,
      chooseallIndexG:null,
      chooseallIndexH:null,
      chooseallIndexJ:null,
      chooseallIndexK:null,
      chooseallIndexL:null,
      chooseallIndexM:null,
      chooseallIndexN:null,
      chooseallIndexP:null,
      chooseallIndexQ:null,
      chooseallIndexR:null,
      chooseallIndexS:null,
      chooseallIndexT:null,
      chooseallIndexW:null,
      chooseallIndexX:null,
      chooseallIndexY:null,
      chooseallIndexZ:null,








    }
  },
  methods:{
    eachKind(index){
      console.log(this.propdatas,'父组件传来的吗')
      // this.chosenKind =this.propdatas
      if(index==0){
        this.$router.push({
          path: '/'
        })
      }else if(index==1){
       this.$router.push({
          path: '/Home'
        })
      }else if(index==2){
        this.$router.push({
          path: '/jointeam'
        })
      }
    },
    choosecity(){
      this.citybox=true
      this.getlistall()
      this.getlhotcity()
      this.getallcity()
    },
    choosearea(index,item){
      this.choosehot=null
      this.choosealla=null
      this.chooseallIndexA=null,
      this.chooseallIndexB=null,
      this.chooseallIndexC=null,
      this.chooseallIndexD=null,
      this.chooseallIndexE=null,
      this.chooseallIndexF=null,
      this.chooseallIndexG=null,
      this.chooseallIndexH=null,
      this.chooseallIndexJ=null,
      this.chooseallIndexK=null,
      this.chooseallIndexL=null,
      this.chooseallIndexM=null,
      this.chooseallIndexN=null,
      this.chooseallIndexP=null,
      this.chooseallIndexQ=null,
      this.chooseallIndexR=null,
      this.chooseallIndexS=null,
      this.chooseallIndexT=null,
      this.chooseallIndexW=null,
      this.chooseallIndexX=null,
      this.chooseallIndexY=null,
      this.chooseallIndexZ=null
      this.chosearea=index
      this.cityId=item.cityId
      this.LocationCity=item.cityName

      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    choosehots(index,item){
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
      this.chooseallIndexB=null,
      this.chooseallIndexC=null,
      this.chooseallIndexD=null,
      this.chooseallIndexE=null,
      this.chooseallIndexF=null,
      this.chooseallIndexG=null,
      this.chooseallIndexH=null,
      this.chooseallIndexJ=null,
      this.chooseallIndexK=null,
      this.chooseallIndexL=null,
      this.chooseallIndexM=null,
      this.chooseallIndexN=null,
      this.chooseallIndexP=null,
      this.chooseallIndexQ=null,
      this.chooseallIndexR=null,
      this.chooseallIndexS=null,
      this.chooseallIndexT=null,
      this.chooseallIndexW=null,
      this.chooseallIndexX=null,
      this.chooseallIndexY=null,
      this.chooseallIndexZ=null
      this.choosehot=index
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallA(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=index,
      this.chooseallIndexB=null,
      this.chooseallIndexC=null,
      this.chooseallIndexD=null,
      this.chooseallIndexE=null,
      this.chooseallIndexF=null,
      this.chooseallIndexG=null,
      this.chooseallIndexH=null,
      this.chooseallIndexJ=null,
      this.chooseallIndexK=null,
      this.chooseallIndexL=null,
      this.chooseallIndexM=null,
      this.chooseallIndexN=null,
      this.chooseallIndexP=null,
      this.chooseallIndexQ=null,
      this.chooseallIndexR=null,
      this.chooseallIndexS=null,
      this.chooseallIndexT=null,
      this.chooseallIndexW=null,
      this.chooseallIndexX=null,
      this.chooseallIndexY=null,
      this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallB(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=index,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallC(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=index,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallD(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=index,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallE(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=index,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallF(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=index,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallG(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=index,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallH(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=index,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallJ(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=index,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallK(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=index,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallL(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=index,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallM(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=index,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallN(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=index,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallP(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=index,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallQ(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=index,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallR(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=index,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallS(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=index,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallT(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=index,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallW(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=index,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallX(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=index,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallY(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=index,
          this.chooseallIndexZ=null
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },
    chooseallZ(index,item){
      this.choosehot=null
      this.chosearea=null
      this.choosealla=null
      this.chooseallIndexA=null,
          this.chooseallIndexB=null,
          this.chooseallIndexC=null,
          this.chooseallIndexD=null,
          this.chooseallIndexE=null,
          this.chooseallIndexF=null,
          this.chooseallIndexG=null,
          this.chooseallIndexH=null,
          this.chooseallIndexJ=null,
          this.chooseallIndexK=null,
          this.chooseallIndexL=null,
          this.chooseallIndexM=null,
          this.chooseallIndexN=null,
          this.chooseallIndexP=null,
          this.chooseallIndexQ=null,
          this.chooseallIndexR=null,
          this.chooseallIndexS=null,
          this.chooseallIndexT=null,
          this.chooseallIndexW=null,
          this.chooseallIndexX=null,
          this.chooseallIndexY=null,
          this.chooseallIndexZ=index
      this.cityId=item.cityId
      this.LocationCity=item.cityName
      setTimeout(()=> {
        this.citybox = false
        localStorage.setItem('cityId',this.cityId);
        localStorage.setItem('cityName',this.LocationCity);
        this.$router.go(0);
      },2000)
    },

    //定位获取现在城市，换取城市id
    getcityid(){
      const time =this.time();
      let params = {
        // type:1,//政策信息
        action:'code.getCityId',
        timestamp: time,
        signature: this.clos_encryptDes("code.getCityId", time,2),
        accessKeyId: "APId1482c4fc9",
        cityName:this.LocationCity,
        deviceId:'1',
      }
      updateFrontUser(params).then(
          (res) => {
            if (res.data.statusCode == 201 && res.data.success == true) {
              this.cityId=res.data.data[0].cityId
              localStorage.setItem('cityId',this.cityId);
            }else{
              this.loading = false;
            }
          }).catch((error) => {
        console.log(error,'99');
      });
    },
    //周边城市
    getlistall(){
      const time =this.time();
      let params = {
        // type:1,//政策信息
        action:'code.getRoundCity',
        timestamp: time,
        signature: this.clos_encryptDes("code.getRoundCity", time,2),
        accessKeyId: "APId1482c4fc9",
        deviceId:'1',
        cityId:this.cityId,
      }
      updateFrontUser(params).then(
          (res) => {
            if (res.data.statusCode == 201 && res.data.success == true) {
               this.listall=res.data.data
            }else{
              this.loading = false;
            }
          }).catch((error) => {
        console.log(error,'99');
      });
    },
    //热门城市
    getlhotcity(){
      const time =this.time();
      let params = {
        // type:1,//政策信息
        action:'code.getHotCity',
        timestamp: time,
        signature: this.clos_encryptDes("code.getHotCity", time,2),
        accessKeyId: "APId1482c4fc9",
        deviceId:'1',
        cityId:this.cityId,
      }
      updateFrontUser(params).then(
          (res) => {
            if (res.data.statusCode == 201 && res.data.success == true) {
              this.hotcity=res.data.data
            }else{
              this.loading = false;
            }
          }).catch((error) => {
        console.log(error,'99');
      });
    },
    //所有城市
    getallcity(){
      const time =this.time();
      let params = {
        // type:1,//政策信息
        action:'code.getCityNames',
        timestamp: time,
        signature: this.clos_encryptDes("code.getCityNames", time,2),
        accessKeyId: "APId1482c4fc9",
        deviceId:'1',
        cityId:this.cityId,
      }
      updateFrontUser(params).then(
          (res) => {
            if (res.data.statusCode == 201 && res.data.success == true) {
              this.allcity=res.data.data.A
              this.allcity2=res.data.data.B
              this.allcity3=res.data.data.C
              this.allcity4=res.data.data.D
              this.allcity5=res.data.data.E
              this.allcity6=res.data.data.F
              this.allcity7=res.data.data.G
              this.allcity8=res.data.data.H
              this.allcity9=res.data.data.J
              this.allcity10=res.data.data.K
              this.allcity11=res.data.data.L
              this.allcity12=res.data.data.M
              this.allcity13=res.data.data.N
              this.allcity14=res.data.data.P
              this.allcity15=res.data.data.Q
              this.allcity16=res.data.data.R
              this.allcity17=res.data.data.S
              this.allcity18=res.data.data.T
              this.allcity19=res.data.data.W
              this.allcity20=res.data.data.X
              this.allcity21=res.data.data.Y
              this.allcity22=res.data.data.Z
            }else{
              this.loading = false;
            }
          }).catch((error) => {
        console.log(error,'99');
      });
    },
    tologin(){
      this.$router.push({
        path: '/'
      })
    },
    getall(){
      // console.log(this.LocationCity,'有吗')
      // AMap.plugin(AMap.CitySearch) =>{
      // this.LocationCity=''
      AMap.plugin('AMap.CitySearch', ()=> {
        var citySearch = new AMap.CitySearch();

        // citySearch.getLocalCity(function (status, result) {
        citySearch.getLocalCity((status, result)=> {
          if (status === 'complete' && result.info === 'OK') {
            // console.log(result,'有吗')
            // 查询成功，result即为当前所在城市信息
            let province = result.province;
            let city = result.city;
            if(localStorage.getItem('cityName')){
              this.LocationCity=localStorage.getItem('cityName')
            }else {
              this.LocationCity=city
            }
            this.getcityid()
          }
        })
      })

    }
  },
  mounted() {
    this.getall()

  },
  created() {
    this.getall()
      const time =this.time();
      let params = {
        action:'website.getWebsiteConfigure',
        timestamp: time,
        signature: this.clos_encryptDes("website.getWebsiteConfigure", time),
        accessKeyId: "APId1482c4fc9",
        deviceId:'1',
      }
      updateFrontUser(params).then(
          (res) => {
            if (res.data.statusCode == 201 && res.data.success == true) {
              this.phonenum=res.data.data[0].companyPhone
              localStorage.setItem('Companyinformation',JSON.stringify(res.data.data[0]));
            }else{
              this.loading = false;
            }
          }).catch((error) => {
        console.log(error,'99');

      });
  }
}
</script>

<style lang='scss' scoped>
.commonHeader{
  height:88px;
  padding:0 220px;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
    .left111{
      //flex:1;
      width: 500px;
      display: flex;
      justify-content: space-around;
      cursor: pointer;
      position: relative;
      .logopng{
        width:121px;
        height: 32px;
        vertical-align: middle;
        //line-height: 88px;
        margin-top: 28px;
      }
      .city{
        padding-bottom:4px;
        box-sizing: border-box;
        display: inline-block;
        border: 1px solid #999999;
        border-radius: 3px;
        width: 87px;
        height: 25px;
        margin-top:32px ;
        font-size: 12px;
        line-height: 25px;
        margin-right: 15px;
        position: relative;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        .bottomstyle{
         vertical-align: middle;
        }
      }
      .phoneStyle{
        font-size: 16px;
        font-family: Source Han Sans CN;
        font-weight: bold;
        color: #141414;
        line-height: 88px;
      }
      .citybox{
        width: 800px;
        background: white;
        height:400px;
        overflow-y: scroll;
        position: absolute;
        top: 70px;
        left: -80px;
        box-shadow: 0px 7px 35px 0px rgba(41, 41, 41, 0.32);
        z-index: 9;
        padding: 20px;
        box-sizing: border-box;
        text-align: left;
        .citybox1{
          font-size: 14px;
          margin-bottom: 8px;
          color: #aaa;
        }
        .citybox1line{
          display: inline-block;
          justify-content: space-around;
          font-size: 14px;
          span{
            display: inline-block;
            padding: 0px 12px;
            //border: 1px solid #ccc;
            border-radius: 3px;
            margin-right:8px;
          }
          .choseareanow{
            display: inline-block;
            padding: 0px 12px;
            //border: 1px solid #ccc;
            border-radius: 3px;
            margin-right:8px;
            color: dodgerblue;
          }
        }
      }
    }
    .right111{
      margin-left: 80px;
      //flex:1;
      width: 330px;
      display: flex;
      justify-content: space-around;
      cursor: pointer;
      font-size: 14px;

      .downphone{
        width: 9px;
        height: 16px;
        vertical-align: middle;
      }
      .downall{
        width: 163px;
        height: 252px;
        position: absolute;
        top:60px;
        right:185px;
        z-index: 9;
        display: none;
      }
      //&:hover {
      // span{
      //   font-weight: bold;
      // }
      //}
      span{
        padding-bottom:4px;
        box-sizing: border-box;
        display: inline-block;
        font-size: 16px;
        color: #141414;
        //font-weight: bold;
        &:nth-child(4):hover {
          .downall{
            display: block;
          }
        }
      }
      .chosenKindStyle{
        color:#F22525;
        border-bottom:2px solid #F22525;

      }
    }
}
</style>
